package com.ciquan.server.service.impl;

import com.ciquan.server.bean.AdminInfo;
import com.ciquan.server.dao.AdminInfoMapper;
import com.ciquan.server.service.AdminInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by bjliwei2014 on 2015/2/27.
 */
@Service
public class AdminInfoServiceImpl implements AdminInfoService {

    @Resource
    private AdminInfoMapper adminInfoMapper;

    @Override
    public AdminInfo login(String username, String password) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("adminname", username);
        map.put("adminpass", password);
        List<AdminInfo> adminInfos = adminInfoMapper.selectList(map);
        if(adminInfos.size() > 0) {
            return adminInfos.get(0);
        }
        return null;
    }
}
